< previous page page_615 next page >

Page 615
of a Data control is to provide data to other controls on the form. You can take a standard control, such as a text box, and "bind" it to a Data control. The text box is then referred to as a bound control. Bound controls are linked to the database, and their contents reflect the current database record provided by the Data control.
note.gif If you have not read Chapter 25, "The Data Control and Data-Bound Controls," you may want to do so now. That chapter discusses the standard Data control as well as the concept of bound controls. square.gif

Setting Up the ADO Data Control
The easiest way to learn how to use a Data control is to create a sample project. In this section, you'll do just that as you learn about the ADO Data control. Begin by opening Visual Basic and starting a new Standard EXE project.
To use the ADO Data control, you must add it to the Visual Basic Toolbox. To do so, right-click in an empty area of the toolbox, select Components from the context menu, and add the Microsoft ADO Data Control 6.0 control.
Next, draw an instance of the ADO Data control on the form. If you have seen the standard Data control, the ADO Data control should look similar, as pictured in Figure 28.4.
0615-01.jpg
Figure 28.4
The ADD Data control links your
program to an ADD data source.
Before you continue setting up the Data control, notice its initial appearance. The four arrow buttons, which look similar to those you might find on an audio CD player, are used to change the current database record. The caption, set by the Caption property, is for informational purposes and should be changed to something meaningful. The initial setting, ADODC1, is the default name of the first ADO Data control.
To connect to a database and retrieve data, you need to set several properties of the ADO Data control. Most of these properties are controlled through the Property Pages dialog box, as shown in Figure 28.5. To display this dialog box, right-click the ADO Data control and choose ADODC Properties from the context menu.

 
< previous page page_615 next page >